<!DOCTYPE html>

{% macro toc(headings) %}
<ol class="toc__sublist">
	{% for heading in headings %}
	<li class="toc__list-item">
		<a href="#{{ heading.id }}" class="no-href">{{heading.content}}</a>
		{% if heading.subheadings | length %} {{ toc(heading.subheadings) }} {%
		endif %}
	</li>
	{% endfor %}
</ol>
{% endmacro %}

<html class="type--{{filetype}}">
	<head>
		<meta charset="utf-8" />
		<title>{{ title }}</title>

		<style type="text/css">
			{{style }}
		</style>
	</head>
	<body>
		{% if options.use_cover %}
		<div class="cover">
			<div class="cover__content">
				{% if author %}
				<p class="cover__author">{{ author }}</p>
				{% endif %}
				<h1 class="cover__title">{{ title }}</h1>
				<p class="cover__subtitle">
					<time class="cover__date" datetime="{{ date }}"
						>{{ date | humandate }}</time
					>
				</p>
			</div>
		</div>
		<div class="cover__sentinel">&nbsp;</div>
		{% endif %} {% if options.use_toc %}
		<nav class="toc">
			<h1 class="toc__title">Table of Contents</h1>
			<ol class="toc__list">
				{% for item in items %}
				<li class="toc__list-item">
					<a href="#{{ item.id }}" class="no-href">
						{{ item.title }}
					</a>
					{% if item.toc | length %} {{ toc(item.toc) }} {% endif %}
				</li>
				{% endfor %}
			</ol>
		</nav>
		{% endif %} {% for item in items %}
		<article id="{{ item.id }}" class="article" lang="{{item.lang}}">
			<header class="article__header">
				<h1 class="article__title">{{ item.title }}</h1>
				{% if item.byline %}
				<p class="article__byline">By <span>{{ item.byline }}</span></p>
				{% endif %} {% if item.published %}
				<p class="article__time">
					Published
					<time datetime="{{item.published}}">
						{{item.published | humandate(true) }} </time
					>{% if item.updated and item.updated !== item.published %}
					&middot; Updated
					<time datetime="{{item.updated}}">
						{{item.updated | humandate(true) }}
					</time>
					{% endif %}
				</p>
				{% endif %}
				<p class="article__url">
					Source:
					<a class="no-href" href="{{item.url}}">{{item.url}}</a>
				</p>
			</header>

			<div class="article__content">{{ item.content }}</div>
		</article>
		{% endfor %}

		<template class="footer-template">
			<!-- Template to use for page footer -->
			<div class="text center">
				<span class="pageNumber"></span>
			</div>
		</template>
	</body>
</html>
